//
// Created by 11510 on 2024/6/18.
//

#ifndef DEMO2_TRIANGLE_H
#define DEMO2_TRIANGLE_H
#include <iostream>
#include "Line.h"
#include "Color.h"

class Triangle: public Line,public Color{
private:
    int _height;
public:
    Triangle(int x1, int y1, int x2, int y2, const char* RGB, int height):
            Line(x1, y1, x2, y2), Color(RGB), _height(height){

    }

    double getPerimeter(){
        return _height + distance() + sqrt(_height * _height + distance() * distance());
    }

    double getArea(){
        return _height * Line::distance() / 2;
    }

    char* getRGB()const {
        return Color::getRGB();
    }

};


#endif //DEMO2_TRIANGLE_H
